import { BasicColumn } from '/@/components/Table/src/types/table';
import { FormProps } from '/@/components/Table';
import { FormSchema } from '/@/components/Form';
import { useI18n } from '/@/hooks/web/useI18n';
import { Getallpersondto, getAllFileTypeTable } from '/@/api/demo/system';
import { uploadFileApi } from '/@/api/sys/upload';

const { t } = useI18n();

/**
 * 模块名:图文档库表格列
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2023/12/26 16:52:30
 */
export function getDocumentColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.demo.documentWorkPlace.documentWorkPlaceTableSet.code'),
      dataIndex: 'name',
      fixed: 'left',
      align: 'left',
      width: 300,
      slots: { customRender: 'name' },
    },
    {
      title: t('routes.demo.documentWorkPlace.documentWorkPlaceTableSet.fileName'),
      dataIndex: 'filename',
      width: 250,
      align: 'left',
    },
    {
      title: t('routes.demo.documentWorkPlace.documentWorkPlaceTableSet.version'),
      dataIndex: 'version',
      width: 50,
    },
    {
      title: t('routes.demo.documentManager.tableData.fileType'),
      dataIndex: 'doctype',
      width: 150,
    },
    {
      title: t('routes.demo.documentWorkPlace.documentWorkPlaceTableSet.status'),
      dataIndex: 'state',
      width: 100,
      slots: { customRender: 'state' },
    },
    {
      title: '是否所属零件',
      dataIndex: 'isPartAttachment',
      width: 150,
      slots: { customRender: 'isPartAttachment' },
    },
    {
      title: t('routes.demo.documentWorkPlace.documentWorkPlaceTableSet.inspector'),
      dataIndex: 'checkOutPerson',
      width: 100,
    },
    {
      title: t('routes.demo.documentWorkPlace.documentWorkPlaceTableSet.creator'),
      dataIndex: 'creator',
      width: 100,
    },
    {
      title: t('routes.demo.documentWorkPlace.documentWorkPlaceTableSet.createTime'),
      dataIndex: 'creattime',
      width: 150,
      slots: { customRender: 'creattime' },
    },
    {
      title: t('routes.demo.documentWorkPlace.documentWorkPlaceTableSet.customAttributeSet'),
      dataIndex: 'customize',
      width: 300,
    },
    {
      title: t('routes.demo.documentWorkPlace.documentWorkPlaceTableSet.isRelatedFile'),
      dataIndex: 'isshortcut',
      width: 200,
      slots: { customRender: 'isshortcut' },
    },
    {
      title: '零件信息',
      dataIndex: 'partInfo',
      width: 600,
      slots: { customRender: 'partInfo' },
      ellipsis: true,
    },
  ];
}
/**
 * 模块名:图文档库搜索
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2023/12/26 16:58:35
 */
export function getDocumentConfig(): Partial<FormProps> {
  return {
    labelWidth: 100,
    colon: true, // 是否显示冒号
    schemas: [
      {
        field: `ThitObjectId`,
        label: t('routes.demo.documentManager.tableData.code'),
        component: 'Input',
        colProps: {
          xl: 12,
          xxl: 8,
        },
        componentProps: {
          placeholder: t('routes.demo.documentManager.tableData.codePlaceholder'),
        },
      },
      {
        field: `name`,
        label: t('routes.demo.documentWorkPlace.documentWorkPlaceTableSet.fileName'),
        component: 'Input',
        colProps: {
          xl: 12,
          xxl: 8,
        },
        componentProps: {
          placeholder: t('routes.demo.documentManager.tableData.fileTypeNamePlaceholder'),
        },
      },
      {
        field: `currevision`,
        label: t('routes.demo.documentWorkPlace.documentWorkPlaceTableSet.version'),
        component: 'Input',
        colProps: {
          xl: 12,
          xxl: 8,
        },
        componentProps: {
          placeholder: t('routes.demo.documentManager.tableData.versionPlaceholder'),
        },
      },
      {
        field: `creator`,
        label: t('routes.demo.documentWorkPlace.documentWorkPlaceTableSet.creator'),
        component: 'ApiSelect',
        colProps: {
          xl: 12,
          xxl: 8,
        },
        componentProps: {
          placeholder: t('routes.demo.documentManager.tableData.creatorPlaceholder'),
          api: Getallpersondto,
          labelField: 'name',
          valueField: 'id',
        },
      },
      {
        field: `createtimeRange`,
        label: t('routes.demo.documentManager.tableData.createTime'),
        component: 'RangePicker',
        colProps: {
          xl: 12,
          xxl: 8,
        },
      },
      {
        field: `status`,
        label: t('routes.demo.documentManager.tableData.status'),
        component: 'Select',
        colProps: {
          xl: 12,
          xxl: 8,
        },
        componentProps: {
          placeholder: t('routes.demo.documentManager.tableData.statusPlaceholder'),
          options: [
            {
              label: t('common.checkOut'),
              value: '1',
            },
            {
              label: t('common.effective'),
              value: '8',
            },
          ],
        },
      },
      {
        field: `doctype`,
        label: t('routes.demo.documentManager.tableData.fileType'),
        component: 'ApiSelect',
        colProps: {
          xl: 12,
          xxl: 8,
        },
        componentProps: {
          api: getAllFileTypeTable,
          placeholder: t('routes.demo.documentManager.tableData.fileTypePlaceholder'),
          labelField: 'name',
          valueField: 'id',
        },
      },
      {
        field: `checkOutPerson`,
        label: t('routes.demo.documentManager.tableData.checkOutPerson'),
        component: 'ApiSelect',
        colProps: {
          xl: 12,
          xxl: 8,
        },
        componentProps: {
          placeholder: t('routes.demo.documentManager.tableData.checkOutPersonPlaceholder'),
          api: Getallpersondto,
          labelField: 'name',
          valueField: 'id',
        },
      },
    ],
    fieldMapToTime: [['createtimeRange', ['createtime', 'lastmodifytime'], 'YYYY-MM-DD']],
  };
}
/**
 * 模块名:图文档详情获取属性
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2023/12/27 15:05:37
 */
export function getAttribute(): FormSchema[] {
  return [
    {
      field: 'thitObjectId',
      component: 'Input',
      label: t('routes.demo.documentManager.tableData.code'),
      componentProps: {
        placeholder: t('routes.demo.documentManager.tableData.codePlaceholder'),
        disabled: true,
      },
    },
    {
      field: 'name',
      component: 'Input',
      label: t('routes.demo.documentManager.tableData.name'),
      componentProps: {
        placeholder: t('routes.demo.documentManager.tableData.namePlaceholder'),
        disabled: true,
      },
    },
    {
      field: 'version',
      component: 'Input',
      label: t('routes.demo.documentManager.tableData.version'),
      componentProps: {
        placeholder: t('routes.demo.documentManager.tableData.versionPlaceholder'),
        disabled: true,
      },
    },
    {
      field: 'creater',
      component: 'Input',
      label: t('routes.demo.documentManager.tableData.creator'),
      componentProps: {
        placeholder: t('routes.demo.documentManager.tableData.creatorPlaceholder'),
        disabled: true,
      },
    },
    {
      field: 'createTime',
      component: 'DatePicker',
      label: t('routes.demo.documentManager.tableData.createTime'),
      componentProps: {
        placeholder: t('routes.demo.documentManager.tableData.createTimePlaceholder'),
        disabled: true,
      },
    },
    {
      field: 'fileName',
      component: 'InputTextArea',
      label: t('routes.demo.documentManager.tableData.sourceFileName'),
      componentProps: {
        placeholder: t('routes.demo.documentManager.tableData.sourceFileNamePlaceholder'),
        disabled: true,
      },
    },
    {
      field: 'state',
      component: 'Input',
      label: t('routes.demo.documentManager.tableData.status'),
      componentProps: {
        placeholder: t('routes.demo.documentManager.tableData.statusPlaceholder'),
        disabled: true,
      },
    },
    {
      field: 'fileType',
      component: 'Input',
      label: t('routes.demo.documentManager.tableData.fileType'),
      componentProps: {
        placeholder: t('routes.demo.documentManager.tableData.fileTypePlaceholder'),
        disabled: true,
      },
    },
    {
      field: 'fileTypeName',
      component: 'Input',
      label: t('routes.demo.documentManager.tableData.fileTypeName'),
      componentProps: {
        placeholder: t('routes.demo.documentManager.tableData.fileTypeNamePlaceholder'),
        disabled: true,
      },
    },
  ];
}
export function getAttributeCopy(): FormSchema[] {
  return [
    {
      field: 'thitObjectId',
      component: 'Input',
      label: t('routes.demo.documentManager.tableData.code'),
      componentProps: {
        placeholder: t('routes.demo.documentManager.tableData.codePlaceholder'),
      },
    },
    {
      field: 'name',
      component: 'Input',
      label: t('routes.demo.documentManager.tableData.name'),
      componentProps: {
        placeholder: t('routes.demo.documentManager.tableData.namePlaceholder'),
      },
    },
    {
      field: 'version',
      component: 'Input',
      label: t('routes.demo.documentManager.tableData.version'),
      componentProps: {
        placeholder: t('routes.demo.documentManager.tableData.versionPlaceholder'),
      },
    },
    {
      field: 'creater',
      component: 'Input',
      label: t('routes.demo.documentManager.tableData.creator'),
      componentProps: {
        placeholder: t('routes.demo.documentManager.tableData.creatorPlaceholder'),
      },
    },
    {
      field: 'createTime',
      component: 'DatePicker',
      label: t('routes.demo.documentManager.tableData.createTime'),
      componentProps: {
        placeholder: t('routes.demo.documentManager.tableData.createTimePlaceholder'),
      },
    },
    {
      field: 'fileName',
      component: 'InputTextArea',
      label: t('routes.demo.documentManager.tableData.sourceFileName'),
      componentProps: {
        placeholder: t('routes.demo.documentManager.tableData.sourceFileNamePlaceholder'),
      },
    },
    {
      field: 'state',
      component: 'Input',
      label: t('routes.demo.documentManager.tableData.status'),
      componentProps: {
        placeholder: t('routes.demo.documentManager.tableData.statusPlaceholder'),
      },
    },
    {
      field: 'fileType',
      component: 'Input',
      label: t('routes.demo.documentManager.tableData.fileType'),
      componentProps: {
        placeholder: t('routes.demo.documentManager.tableData.fileTypePlaceholder'),
      },
      dynamicDisabled: true,
    },
    {
      field: 'fileTypeName',
      component: 'Input',
      label: t('routes.demo.documentManager.tableData.fileTypeName'),
      componentProps: {
        placeholder: t('routes.demo.documentManager.tableData.fileTypeNamePlaceholder'),
      },
    },
  ];
}
/**
 * 模块名:图文档详情附件
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2023/12/27 16:45:40
 */
export function getAttachment(): BasicColumn[] {
  return [
    {
      title: t('routes.demo.documentManager.tableData.fileName'),
      dataIndex: 'fileName',
      fixed: 'left',
      width: 300,
    },
    {
      title: t('routes.demo.documentManager.tableData.fileSize'),
      dataIndex: 'fileSize',
      width: 100,
    },
    {
      title: t('routes.demo.documentManager.tableData.localPath'),
      dataIndex: 'fileUrl',
      width: 100,
    },
  ];
}
/**
 * 模块名:图文档详情关联
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2023/12/28 14:11:44
 */
export function getAssociation(): BasicColumn[] {
  return [
    {
      title: t('routes.demo.documentManager.tableData.code'),
      dataIndex: 'thitObjectId',
      fixed: 'left',
      width: 300,
    },
    {
      title: t('routes.demo.documentManager.tableData.version'),
      dataIndex: 'version',
      width: 100,
    },
    {
      title: t('routes.demo.documentManager.tableData.name'),
      dataIndex: 'name',
      width: 100,
    },
    {
      title: t('routes.demo.documentManager.tableData.fileType'),
      dataIndex: 'doctype',
      width: 100,
    },
    {
      title: t('routes.demo.documentManager.tableData.creator'),
      dataIndex: 'creater',
      width: 100,
    },
  ];
}
/**
 * 模块名:图文档详情被关联
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2023/12/28 14:11:44
 */
export function getBeAssociation(): BasicColumn[] {
  return [
    {
      title: t('routes.table.BeAssociationList.Code'),
      dataIndex: 'file1',
      fixed: 'left',
      width: 300,
    },
    {
      title: t('routes.table.BeAssociationList.Version'),
      dataIndex: 'file2',
      width: 100,
    },
    {
      title: t('routes.table.BeAssociationList.Name'),
      dataIndex: 'file3',
      width: 100,
    },
    {
      title: t('routes.table.BeAssociationList.Type'),
      dataIndex: 'file4',
      width: 100,
    },
    {
      title: t('routes.table.BeAssociationList.Creator'),
      dataIndex: 'file5',
      width: 100,
    },
  ];
}
/**
 * 模块名:图文档详情被关联
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2023/12/28 14:11:44
 */
export function getPartsList(): BasicColumn[] {
  return [
    {
      title: '对象代号',
      dataIndex: 'file1',
      fixed: 'left',
      width: 300,
    },
    {
      title: '版本',
      dataIndex: 'file2',
      width: 100,
    },
    {
      title: '数量',
      dataIndex: 'file3',
      width: 100,
    },
    {
      title: '对象类型',
      dataIndex: 'file4',
      width: 100,
    },
    {
      title: '对象名称',
      dataIndex: 'file5',
      width: 100,
    },
    {
      title: '创建人',
      dataIndex: 'file6',
      width: 100,
    },
    {
      title: '创建日期',
      dataIndex: 'file7',
      width: 100,
    },
    {
      title: '状态',
      dataIndex: 'file8',
      width: 100,
    },
    {
      title: '检出人',
      dataIndex: 'file9',
      width: 100,
    },
    {
      title: '自定义属性集',
      dataIndex: 'file10',
      width: 100,
    },
  ];
}

/**
 * 模块名:添加修改目录
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2024/02/04 09:06:12
 */
export function getDirectoryModal(isUpdate): FormSchema[] {
  return [
    {
      field: 'folderName',
      component: 'Input',
      label: t('routes.demo.documentManager.tableData.directoryName'),
      defaultValue: '',
      required: true,
      componentProps: {
        placeholder: t('routes.demo.documentManager.tableData.directoryNamePlaceholder'),
      },
    },
    {
      field: 'initializeCode',
      component: 'Input',
      label: t('routes.demo.documentManager.tableData.codeValue'),
      defaultValue: '',
      componentProps: {
        placeholder: t('routes.demo.documentManager.tableData.codeValuePlaceholder'),
      },
    },
    {
      field: 'jointName',
      component: 'Input',
      label: t('routes.demo.documentManager.tableData.codeName'),
      defaultValue: '',
      componentProps: {
        placeholder: t('routes.demo.documentManager.tableData.codeNamePlaceholder'),
      },
    },
    {
      field: 'inheritParent',
      component: 'Select',
      label: t('routes.demo.documentManager.tableData.bindPermission'),
      defaultValue: '1',
      required: true,
      helpMessage: t('routes.demo.documentManager.tableData.inheritParentPermission'),
      ifShow: () => {
        return !isUpdate.value;
      },
      componentProps: {
        placeholder: t('routes.demo.documentManager.tableData.selectBindPermission'),
        options: [
          {
            label: t('common.yes'),
            value: '1',
          },
          {
            label: t('common.no'),
            value: '0',
          },
        ],
      },
    },
  ];
}

/**
 * 模块名:版本展示
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2024/02/20 15:44:57
 */
export function getPartVersionList(): BasicColumn[] {
  return [
    {
      title: t('routes.table.showVersionList.documentCode'),
      dataIndex: '图档代号',
      fixed: 'left',
      width: 300,
    },
    {
      title: t('routes.table.showVersionList.documentName'),
      dataIndex: '图档名称',
      width: 100,
    },
    {
      title: t('routes.table.showVersionList.version'),
      dataIndex: '版本',
      width: 100,
    },
    {
      title: t('routes.table.showVersionList.creator'),
      dataIndex: '创建人',
      width: 100,
    },
    {
      title: t('routes.table.showVersionList.createTime'),
      dataIndex: '创建日期',
      width: 100,
    },
    {
      title: t('routes.table.showVersionList.sourceFileName'),
      dataIndex: '源文件名',
      width: 100,
    },
    {
      title: t('routes.table.showVersionList.securityLevel'),
      dataIndex: '安全级别',
      width: 100,
    },
    {
      title: t('routes.table.showVersionList.fileType'),
      dataIndex: '文件类型',
      width: 100,
    },
  ];
}
/**
 * 模块名:关联图档
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2024/02/20 15:52:04
 */
export function getAssociatedImageList(): BasicColumn[] {
  return [
    {
      title: t('routes.demo.documentWorkPlace.relatedDocumentsSet.code'),
      dataIndex: 'dh',
      fixed: 'left',
      width: 300,
    },
    {
      title: t('routes.demo.documentWorkPlace.relatedDocumentsSet.name'),
      dataIndex: 'name',
      width: 200,
    },
    {
      title: t('routes.demo.documentWorkPlace.relatedDocumentsSet.version'),
      dataIndex: 'versoin',
      width: 100,
    },
    {
      title: t('routes.demo.documentWorkPlace.relatedDocumentsSet.fileType'),
      dataIndex: 'type',
      width: 100,
    },
  ];
}

/**
 * 模块名:
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2024/03/01 11:21:47
 */
export function getBorrowForm(): FormSchema[] {
  return [
    {
      field: 'wfinsid',
      component: 'Input',
      label: t('routes.demo.documentManager.instanceDetailSet.instanceCode'),
      componentProps: {
        readonly: true,
      },
      colProps: {
        xl: 12,
        xxl: 12,
      },
    },
    {
      field: 'wfinsname',
      component: 'Input',
      label: t('routes.demo.documentManager.instanceDetailSet.instanceName'),
      componentProps: {
        readonly: true,
      },
      colProps: {
        xl: 12,
        xxl: 12,
      },
    },
    {
      field: 'wfinstate',
      component: 'Input',
      label: t('routes.demo.documentManager.instanceDetailSet.instanceStatus'),
      componentProps: {
        readonly: true,
      },
      colProps: {
        xl: 12,
        xxl: 12,
      },
    },
    {
      field: 'wfinscreatorname',
      component: 'Input',
      label: t('routes.demo.documentManager.instanceDetailSet.creator'),
      componentProps: {
        readonly: true,
      },
      colProps: {
        xl: 12,
        xxl: 12,
      },
    },
    {
      field: 'wfinscreatetime',
      component: 'DatePicker',
      label: t('routes.demo.documentManager.instanceDetailSet.createTime'),
      componentProps: {
        disabled: true,
      },
      colProps: {
        xl: 12,
        xxl: 12,
      },
    },
  ];
}

// 获取所有流程步骤数据
export function getFlowDetailColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.demo.documentManager.setAllStepsData.step'),
      dataIndex: 'stepname',
      fixed: 'left',
      width: 200,
    },
    {
      title: t('routes.demo.documentManager.setAllStepsData.stepStatus'),
      dataIndex: 'stepstate',
      width: 150,
    },
    {
      title: t('routes.demo.documentManager.setAllStepsData.comment'),
      dataIndex: 'steppz',
      width: 150,
    },
    {
      title: t('routes.demo.documentManager.setAllStepsData.evaluation'),
      dataIndex: 'projscore',
      width: 150,
    },
    {
      title: t('routes.demo.documentManager.setAllStepsData.stepPrincipal'),
      dataIndex: 'stepactor',
      width: 150,
    },
    {
      title: t('routes.demo.documentManager.setAllStepsData.signer'),
      dataIndex: 'stepsign',
      width: 150,
    },
    {
      title: t('routes.demo.documentManager.setAllStepsData.signTime'),
      dataIndex: 'stepsigntime',
      width: 150,
      slots: { customRender: 'stepsigntime' },
    },
    {
      title: t('routes.demo.documentManager.setAllStepsData.remark'),
      dataIndex: 'stepnotes',
      width: 150,
    },
  ];
}

// 获取导入文件表单
export function getImportForm(): FormSchema[] {
  return [
    {
      field: 'DocType',
      component: 'Select',
      label: t('routes.demo.documentWorkPlace.fileType'),
      required: true,
      defaultValue: undefined,
      componentProps: {
        placeholder: t('routes.demo.documentWorkPlace.fileTypePlaceholder'),
        colProps: {
          xl: 12,
          xxl: 8,
        },
      },
    },
    {
      field: 'selectType',
      component: 'RadioGroup',
      label: '上传格式',
      helpMessage: t('routes.demo.documentWorkPlace.selectMessage'),
      defaultValue: '1',
      componentProps: {
        options: [
          {
            label: t('routes.demo.documentWorkPlace.selectFile'),
            value: '1',
          },
          {
            label: t('routes.demo.documentWorkPlace.selectFolder'),
            value: '2',
          },
        ],
        colProps: {
          xl: 12,
          xxl: 8,
        },
      },
    },
    {
      field: 'DhType',
      component: 'RadioGroup',
      label: t('routes.demo.documentWorkPlace.codeGenerateSet'),
      defaultValue: '0',
      componentProps: {
        options: [
          {
            label: t('routes.demo.documentWorkPlace.codeAutoGenerate'),
            value: '0',
          },
          {
            label: t('routes.demo.documentWorkPlace.codeSourceFileName'),
            value: '1',
          },
          {
            label: t('routes.demo.documentWorkPlace.codeSourceFileNameAddSuffix'),
            value: '2',
          },
          {
            label: t('routes.demo.documentWorkPlace.codeDirectoryRule'),
            value: '3',
          },
        ],
        colProps: {
          xl: 12,
          xxl: 8,
        },
      },
    },
    {
      field: 'files',
      component: 'Upload',
      label: '上传',
      colProps: {
        xl: 12,
        xxl: 8,
      },
      slot: 'menu',
      defaultValue: [],
      rules: [{ required: true, message: '请选择上传文件' }],
    },
  ];
}

// 目录工作指派表格
export function getDirAssignColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.demo.documentManager.DirAssignTableSet.code'),
      dataIndex: 'dh',
      fixed: 'left',
      width: 200,
    },
    {
      title: t('routes.demo.documentManager.DirAssignTableSet.type'),
      dataIndex: 'docTypeName',
      width: 150,
    },
    {
      title: t('routes.demo.documentManager.DirAssignTableSet.name'),
      dataIndex: 'name',
      width: 150,
    },
    {
      title: t('routes.demo.documentManager.DirAssignTableSet.version'),
      dataIndex: 'version',
      width: 150,
    },
    {
      title: t('routes.demo.documentManager.DirAssignTableSet.inspector'),
      dataIndex: 'holderName',
      width: 150,
    },
    {
      title: t('routes.demo.documentManager.DirAssignTableSet.hasStructure'),
      dataIndex: 'hassub',
      width: 150,
    },
  ];
}

export function getDirAssignModal(): FormSchema[] {
  return [
    {
      field: 'holderName',
      component: 'Input',
      label: t('routes.demo.documentManager.admitter'),
      colProps: {
        xl: 8,
        xxl: 8,
      },
      componentProps: {
        disabled: true,
      },
    },
    {
      field: 'receiver',
      component: 'Select',
      label: t('routes.demo.documentManager.receiver'),
      required: true,
      colProps: {
        xl: 8,
        xxl: 8,
      },
      componentProps: {
        placeholder: t('routes.demo.documentManager.pleaseSelectReceiver'),
      },
    },
  ];
}

export function getDocAssignModal(): FormSchema[] {
  return [
    {
      field: 'holderName',
      component: 'Input',
      label: t('routes.demo.documentManager.admitter'),
      colProps: {
        xl: 12,
        xxl: 12,
      },
      componentProps: {
        disabled: true,
      },
    },
    {
      field: 'receiver',
      component: 'Select',
      label: t('routes.demo.documentManager.receiver'),
      required: true,
      colProps: {
        xl: 12,
        xxl: 12,
      },
      componentProps: {
        placeholder: t('routes.demo.documentManager.pleaseSelectReceiver'),
      },
    },
    {
      field: 'name',
      component: 'Input',
      label: t('routes.demo.documentManager.objectCode'),
      colProps: {
        xl: 12,
        xxl: 12,
      },
      componentProps: {
        disabled: true,
      },
    },
    {
      field: 'version',
      component: 'Input',
      label: t('routes.demo.documentManager.objectVersion'),
      colProps: {
        xl: 12,
        xxl: 12,
      },
      componentProps: {
        disabled: true,
      },
    },
    {
      field: 'BOM',
      component: 'Checkbox',
      label: t('routes.demo.documentManager.bom'),
      colProps: {
        xl: 12,
        xxl: 12,
      },
    },
  ];
}

export function getExtractImportForm(): FormSchema[] {
  return [
    {
      field: 'Divider1',
      component: 'Divider',
      label: t('routes.demo.documentManager.ImportTypeSelection'),
    },
    {
      field: 'ImportTypeSelection',
      component: 'ApiSelect',
      label: '',
      defaultValue: '',
      colProps: {
        xl: 12,
        xxl: 12,
      },
    },
    {
      field: 'selectFileOrFolder',
      component: 'RadioGroup',
      label: '',
      defaultValue: '1',
      colProps: {
        xl: 10,
        xxl: 10,
        offset: 2,
      },
      componentProps: {
        options: [
          { label: t('routes.demo.documentManager.selectFile'), value: '1' },
          { label: t('routes.demo.documentManager.selectFolder'), value: '2' },
        ],
      },
    },
    {
      field: 'Divider2',
      component: 'Divider',
      label: t('routes.demo.documentManager.warehousingSettings'),
    },
    {
      field: 'warehousingSettings',
      component: 'CheckboxGroup',
      label: '',
      defaultValue: [],
      componentProps: {
        options: [
          { label: t('routes.demo.documentManager.createPart'), value: '1' },
          { label: t('routes.demo.documentManager.createDocument'), value: '2' },
          { label: t('routes.demo.documentManager.matchingPartStructure'), value: '3' },
          { label: t('routes.demo.documentManager.autoCreateDocumentPartRelation'), value: '4' },
          { label: t('routes.demo.documentManager.propertyOverridesBOMProperty'), value: '5' },
        ],
      },
    },
    {
      field: 'featurePartSetting',
      component: 'Select',
      label: t('routes.demo.documentManager.featurePartSetting'),
      defaultValue: '',
      componentProps: {
        options: [
          { label: t('routes.demo.documentManager.extractPartType'), value: '1' },
          { label: t('routes.demo.documentManager.extractPartTypeNotSpecified'), value: '2' },
        ],
      },
    },
    {
      field: 'specificPartType',
      component: 'Input',
      label: t('routes.demo.documentManager.specificPartType'),
      defaultValue: '',
      dynamicDisabled: ({ values }) => {
        return !values.featurePartSetting;
      },
    },
    {
      field: 'selectProject',
      component: 'ApiSelect',
      label: t('routes.demo.documentManager.selectProject'),
      defaultValue: '',
      dynamicDisabled: ({ values }) => {
        return !values.featurePartSetting;
      },
      colProps: {
        xl: 10,
        xxl: 10,
      },
      itemProps: {
        labelAlign: 'left',
        labelCol: {
          span: 6,
        },
        wrapperCol: {
          span: 18,
        },
      },
    },
    {
      field: 'featureProject',
      component: 'ApiSelect',
      label: t('routes.demo.documentManager.featureProject'),
      defaultValue: '',
      dynamicDisabled: ({ values }) => {
        return !values.featurePartSetting;
      },
      colProps: {
        xl: 10,
        xxl: 10,
        offset: 2,
      },
      itemProps: {
        labelAlign: 'left',
        labelCol: {
          span: 6,
        },
        wrapperCol: {
          span: 18,
        },
      },
    },
    {
      field: 'mergeItemSeparator',
      component: 'Input',
      label: t('routes.demo.documentManager.mergeItemSeparator'),
      defaultValue: '',
      dynamicDisabled: ({ values }) => {
        return !values.featurePartSetting;
      },
    },
  ];
}

export function getExcelImportForm(): FormSchema[] {
  return [
    {
      field: 'importTypeSelection',
      component: 'RadioGroup',
      label: t('routes.demo.documentWorkPlace.importTypeSelection'),
      defaultValue: '1',
      componentProps: {
        options: [
          { label: t('routes.demo.documentWorkPlace.document'), value: '1' },
          { label: t('routes.demo.documentWorkPlace.part'), value: '2' },
          { label: t('routes.demo.documentWorkPlace.bomStructure'), value: '3' },
        ],
      },
    },
    {
      field: 'documentTypeSelection',
      component: 'ApiSelect',
      label: t('routes.demo.documentWorkPlace.documentTypeSelection'),
      defaultValue: '',
      componentProps: {
        placeholder: t('routes.demo.documentWorkPlace.documentTypePlaceholder'),
      },
      dynamicDisabled: ({ values }) => {
        return values.importTypeSelection !== '1';
      },
    },
    {
      field: 'partTypeSelection',
      component: 'ApiSelect',
      label: t('routes.demo.documentWorkPlace.partTypeSelection'),
      defaultValue: '',
      componentProps: {
        placeholder: t('routes.demo.documentWorkPlace.partTypePlaceholder'),
      },
      dynamicDisabled: ({ values }) => {
        return values.importTypeSelection !== '2';
      },
    },
    {
      field: 'ProductStructureSelection',
      component: 'RadioGroup',
      label: t('routes.demo.documentWorkPlace.ProductStructureSelection'),
      defaultValue: '1',
      componentProps: {
        options: [
          { label: t('routes.demo.documentWorkPlace.rebuildProductStructure'), value: '1' },
          { label: t('routes.demo.documentWorkPlace.propertyDifferenceUpdate'), value: '2' },
          { label: t('routes.demo.documentWorkPlace.onlyAddNewRelation'), value: '3' },
        ],
      },
      dynamicDisabled: ({ values }) => {
        return values.importTypeSelection !== '3';
      },
    },
  ];
}

export function getPartAssColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.demo.documentUseSetting.partCode'),
      dataIndex: 'partThitObjectId',
      fixed: 'left',
      width: 300,
    },
    {
      title: t('routes.demo.documentUseSetting.partVersion'),
      dataIndex: 'partVersion',
      width: 120,
    },
    {
      title: t('routes.demo.documentUseSetting.figureDocName'),
      dataIndex: 'docName',
      width: 120,
    },
    {
      title: t('routes.demo.documentUseSetting.figureDocVersion'),
      dataIndex: 'docVersion',
      width: 120,
    },
  ];
}

export function getDocAssColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.demo.documentUseSetting.assDocCode'),
      dataIndex: 'superDocThitObjectId',
      fixed: 'left',
      width: 300,
    },
    {
      title: t('routes.demo.documentUseSetting.assDocVersion'),
      dataIndex: 'superDocVersion',
      width: 120,
    },
    {
      title: t('routes.demo.documentUseSetting.assDocName'),
      dataIndex: 'superDocName',
      width: 120,
    },
    {
      title: t('routes.demo.documentUseSetting.figureDocName'),
      dataIndex: 'docName',
      width: 120,
    },
    {
      title: t('routes.demo.documentUseSetting.figureDocVersion'),
      dataIndex: 'docVersion',
      width: 120,
    },
  ];
}

export function getPerTypeModalColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.modal.permissionModal.fileType'),
      dataIndex: 'nameWithId',
      width: 150,
    },
  ];
}

export function getAttrForm(): FormSchema[] {
  return [
    {
      field: 'fileUrls',
      component: 'Upload',
      label: '附件',
      componentProps: {
        api: uploadFileApi,
        maxNumber: 1,
        maxSize: 50,
      },
    },
  ];
}

export function getDirectoryColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.components.documentReuseModal.catalogName'),
      dataIndex: 'title',
      align: 'left',
      slots: { customRender: 'title' },
    },
  ];
}
